package com.zhwmall.member.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhwmall.common.entity.member.MemberLevelEntity;
import com.zhwmall.common.utils.PageUtils;
import com.zhwmall.common.utils.Query;
import com.zhwmall.member.dao.MemberLevelDao;
import com.zhwmall.member.service.MemberLevelService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("memberLevelService")
public class MemberLevelServiceImpl extends ServiceImpl<MemberLevelDao, MemberLevelEntity> implements MemberLevelService {


    @Override
    public PageUtils selectPageMemberLever(Map<String, Object> params) {
        String key = (String)params.get("input");

        IPage<MemberLevelEntity> page = this.page(
                new Query<MemberLevelEntity>().getPage(params),
                new QueryWrapper<MemberLevelEntity>().like(StringUtils.isNotBlank(key),"name", key)
        );


        return new PageUtils(page);
    }

    @Override
    public void removeMemberLevelByIds(List<Long> asList) {
        baseMapper.deleteBatchIds(asList);
    }

}